﻿using AutoMapper;
using MediatR;
using S.Breeding.Domain;
using S.Breeding.Infrastructure;
using S.Breeding.Read.Api.Application.Command.DeathManageCommand;

namespace S.Breeding.Read.Api.Application.CommandHandlers.DeathManageCommandHandlers
{
    public class DeathManageEditCommandHandlers : IRequestHandler<DeathManageEditCommand, DeathManage>
    {
        private readonly IRepository<DeathManage> repository;  
        private readonly IMapper mapper;
        public DeathManageEditCommandHandlers(IRepository<DeathManage> repository, IMapper mapper)
        {
            this.repository = repository;
            this.mapper = mapper;
        }
        public async Task<DeathManage> Handle(DeathManageEditCommand request, CancellationToken cancellationToken)
        {
            return await repository.GetAsync(request.DMId);
        }
    }
}
